#pragma once

#include "D3DInterface.h"
#include <d3dx9mesh.h>

class CMirror : public IFramework
{
public:
	CMirror(IDirect3DDevice9 **p);
	virtual ~CMirror(void);

	// Interface
public:
	virtual bool Setup();
	virtual bool Display(float timeDelta);
	virtual void Cleanup();

	struct Vertex
	{
		Vertex(){}
		Vertex(float x, float y, float z, 
			float nx, float ny, float nz,
			float u, float v)
		{
			_x  = x;  _y  = y;  _z  = z;
			_nx = nx; _ny = ny; _nz = nz;
			_u  = u;  _v  = v;
		}
		float _x, _y, _z;
		float _nx, _ny, _nz;
		float _u, _v;

		static const DWORD FVF;
	};

private:
	void RenderScene();
	void RenderMirror();
	void RenderShadow();

private:
	IDirect3DDevice9 *pDevice;

	IDirect3DVertexBuffer9 *VB;
	IDirect3DTexture9 *FloorTex;
	IDirect3DTexture9 *WallTex;
	IDirect3DTexture9 *MirrorTex;

	D3DMATERIAL9 FloorMtrl;
	D3DMATERIAL9 WallMtrl;
	D3DMATERIAL9 MirrorMtrl;

	ID3DXMesh *Teapot;
	D3DMATERIAL9 TeapotMtrl;
	D3DXVECTOR3 TeapotPosition;
};

